/**
 * all the serve up methods are here
 */
const gulp = require('gulp');
const server = require('gulp-server-io');
const config = require('config');
const { join } = require('path');

const PATHS = config.get('paths');

// wrapper for construct other task
const createServer = (paths , opt) => {
  return gulp.src(paths)
    .pipe(server(opt));
};

// main serve dev task
exports.serveAmpTask = (opt={}) => {
  return createServer([
    config.get('paths.dev')
  ], Object.assign({
    port: 6677
  }, opt));
};

exports.serveHtml = dir => () => gulp.src([dir])
  .pipe(server({
      debugger: false,
      port: 34567
    })
  );
